﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Demo.ServiceFolderOp
{
    public partial class Service1 : ServiceBase
    {
        System.Timers.Timer timer1;
        public Service1()
        {
            InitializeComponent();
        }

        private void ServiceFolderOp()
        {

        }

        protected override void OnStart(string[] args)
        {
            //服务开始执行代码
            timer1 = new System.Timers.Timer();
            timer1.Interval = 3000;
            timer1.Elapsed += new System.Timers.ElapsedEventHandler(timer1_Elapsed);
            timer1.Enabled = true;
            //*/设置定时器*/
            //TimerCallback myTimerCallback;
            ////myTimerCallback.BeginInvoke(null, ServiceFolderOp, null);
            ////myTimerCallback.BeginInvoke(,);
            ////myTimerCallback.EndInvoke(,)
            //Timer timer = new Timer(myTimerCallback);
        }

        protected override void OnStop()
        {
            //服务结束执行代码
            this.timer1.Enabled = false;
        }

        #region 执行方法
        private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {

        }
        #endregion
    }
}
